<include file="Public/head" />
<style type="text/css">
    .cheyuan1,.cheyuan2{display: block;margin-top: 15px;}
    .cheyuan2{color: #303030;float: left;margin-left: 20px;margin-bottom:15px;}
    .cheyuan2 .car_no_state{ border: 1px solid #d7d7d7;height: 22px;line-height: 22px;margin-left: 10px;text-align: center;width: 150px;}
    .create_marks{ background: #20ab4f none repeat scroll 0 0; border: medium none;border-radius: 3px;color: #fff;margin-left: 7px;padding: 0;width: 120px;}
    .cheyuan-btn{ background: #20ab4f none repeat scroll 0 0; border: medium none;border-radius: 3px;color: #fff;margin-left: 7px;padding: 0;width: 80px;height:24px;}
    .cheyuan2 select{ border: 1px solid #d7d7d7;float: left;height: 22px;line-height: 22px;text-align: center;width: 150px;margin-left: 36px; }
    .marks_manage{
        background: #fff none repeat scroll 0 0;
        border: 1px solid #20ab4f;border-radius: 3px;display: none; height: 220px;left: 50%;margin: -110px 0 0 -277px;position: fixed;top: 50%;width: 554px;
        z-index: 999999; }
    .marks_manage h3{background: #cecece none repeat scroll 0 0;border: 1px solid #ededee;
                     border-radius: 3px;color: #333;display: block;font-size: 18px;height: 38px; line-height: 38px;text-align: center;}
    .marks_manage .queding{background: #20ab4f none repeat scroll 0 0;border: medium none;border-radius: 3px;color: #fff; float: left;font-size: 14px; height: 30px;
                           line-height: 30px;margin: 0 38px;text-align: center;width: 170px;}
    .marks_manage  .quxiao{
        background: #fff none repeat scroll 0 0;border: 1px solid #20ab4f;border-radius: 3px;color: #20ab4f;float: left;
        font-size: 14px;height: 30px;line-height: 30px;text-align: center; width: 170px;}
    .marks_manage ul li{
        /*        border: 1px solid red;*/
        margin: 10px 15px;
        float:left;
    }
</style>
</head>
<include file="Public/common_header" />
<div class="mian">
    <include file="Public/sidebar"  menu="cyxs.xs" />

    <div class="mianR">
        <div class="yuyue">
            <ul>
                <li onclick="get_list(1);" class="yuCurrent">待上架</li>
                <li onclick="get_list(2);">销售中</li>
                <li onclick="get_list(3);">销售成功</li>
                <li onclick="get_list(4);">销售失败</li>
            </ul>
        </div>
        <!--        <h3 class="cha">车源销售</h3>-->
        <div class="cheyuan1 clearfix">
            <script src="http://img2.isou365.cn/paimai/cheshan/js/model_select.js" type="text/javascript"></script>
        </div>
        <div class="cheyuan2">
            <!--            <select name="car_status" id="car_status" style="margin-left:40px;">
                            <option value="">请选择状态</option>
                            <option value="1">待上架</option>
                            <option value="2">销售中</option>
                            <option value="3">销售成功</option>
                        </select>-->
            <select name="car_marks" id="car_marks">
                <option value="">请选择标签</option>
                <volist name="car_marks" id="cm">
                    <option value="{$cm}">{$cm}</option>
                </volist>
            </select>
            <input type="text" name="car_no_state" placeholder="车辆编号" class="car_no_state"/>
            <input type="button" value="搜索" name="cyxs_search" class="cheyuan-btn"  />
            <!--            <input type="button" name="create_marks" class="create_marks" value="车辆标签管理"/>-->
        </div>
        <div class="marks_manage" style="display:none;">
            <h3>管理标签</h3>
            <ul>
                <li class="clearfix"><input type="text" id="mark1" value=""/></li>
                <li class="clearfix"><input type="text" id="mark2" value=""/></li>
                <li class="clearfix"><input type="text" id="mark3" value=""/></li>
                <li class="clearfix"><input type="text" id="mark4" value=""/></li>
                <li class="clearfix"><input type="text" id="mark5" value=""/></li>
                <li class="clearfix"><input type="text" id="mark6" value=""/></li>
                <li class="clearfix"><input type="text" id="mark7" value=""/></li>
                <li class="clearfix"><input type="text" id="mark8" value=""/></li>
                <li class="clearfix"><input type="text" id="mark9" value=""/></li>
                <li class="clearfix">
                    <input type="button" class="queding" value="确定"/>
                    <input type="button" class="quxiao" value="取消"/>
                </li>
            </ul>
        </div>
        <div class="yunBei" style="z-index:999998"></div>
        <div class="yuList">
            <div class="listBox" id="listBox"></div>
        </div>
    </div>
    <div class="clear"></div>
    <script type="text/javascript">
                    $('.create_marks').on('click', function () {
//            $(".yunBei").css("display", "block");
                        $('.marks_manage').fadeIn();
                    });
                    //取消按钮事件监听
                    $(".quxiao").on('click', function () {
//            $(".yunBei").css("display", "none");
                        $(".marks_manage").fadeOut();
                    });
                    //获取url中的参数
                    function getUrlParam(name) {
                        var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)"); //构造一个含有目标参数的正则表达式对象
                        var r = window.location.search.substr(1).match(reg);  //匹配目标参数
                        if (r != null)
                            return unescape(r[2]);
                        return null; //返回参数值
                    }
                    var curr_car_status = getUrlParam('car_status');
                    if (curr_car_status) {
                        get_list(curr_car_status);
                    } else {
                        get_list(1);
                    }
                    function get_list(car_status) {
                        var url = mkurl();
                        var p = getUrlParam('p');
                        if (p != null) {
                            var purl = "&p="+p;
                        }else{
                            var purl = "&p=1";
                        }
                        $.get("{:U('CarShow/car_list')}?car_status=" + car_status+purl, encodeURI(url), function (data) {
                            $("#listBox").html(data);
                        }, "html");
                        if (car_status == '1') {
                            $("#car_marks").hide();
                            $('.cheyuan1').removeClass('clearfix');
                            $('.cheyuan2').css('float', 'none');
                        } else {
                            $("#car_marks").show();
                            $('.cheyuan1').addClass('clearfix');
                            $('.cheyuan2').css('float', 'left');
                        }
                        $('.yuyue ul li').each(function (i, item) {
                            $(this).eq(i).removeClass('yuCurrent');
                        });
                        var curr_index = car_status - 1;
                        $('.yuyue ul li').eq(curr_index).addClass('yuCurrent');
                    }

                    function get_page(p) {
                        var url = mkurl();
                        $.get("{:U('CarShow/car_list/" + encodeURI("p/" + p) + "')}?car_status=" + $("#car_status").val(), url, function (data) {
                            $("#listBox").html(data);
                        }, "html");
                    }
                    $("input[name='cyxs_search']").on("click", function () {
                        var car_status = $("#car_status").val();
                        get_list(car_status);
                    });
                    //搜索
                    function mkurl() {
                        var url = "";
                        var brand_id = $('.pingXiaCo').attr('brand_id');
                        var series_id = $('.cheXiaCo').attr('series_id');
                        var model_id = $('.cheXiaCo1').attr('model_id');
//                        var car_status = $("select[name='car_status']").val();
                        var car_mark = $("select[name='car_marks']").val();
                        var car_no_state = $("input[name='car_no_state']").val();
                        if (brand_id) {
                            url += '&brand_id=' + brand_id;
                        }
                        if (series_id) {
                            url += '&series_id=' + series_id;
                        }
                        if (model_id) {
                            url += '&model_id=' + model_id;
                        }
//                        if (car_status) {
//                            url += '&car_status=' + car_status;
//                        }
                        if (car_mark) {
                            url += '&car_mark=' + car_mark;
                        }
                        if (car_no_state) {
                            url += '&car_no_state=' + car_no_state;
                        }
                        return url;
                    }
                    function change_store_status(store_id, store_status) {
                        var post_data = {store_id: store_id};
                        $.post("{:U('CarShow/car_list')}", post_data, function (res) {
                            if (res.code == 200) {
                                delay_alert('操作成功!');
                                setTimeout(function () {
                                    window.location.reload();
                                }, 300);
                            } else {
                                delay_alert(res.msg);
                            }
                        }, 'json');
                        return false;
                    }
                    ;
    </script>
    <include file="Public/foot" />
